﻿var myVue = new Vue({
	el: "body",
	data: {
		list: "",
		myid: "",
		nowinfo: "",
		mycurr: true
	},
	methods: {
		detail: function(e) {
			this.nowinfo = e;
			e.attributes.info = false;
			console.log(e);
			console.log(e.attributes.other);
			//			e.attributes.info="2";
			$("#my-alert").modal('open');
		}
	},
	created: function() {
		init();
		
		getinfo(this);
	}
})

//初始化
function init() {
	var APP_ID = 'Wx3JTgmqBaARoWCaGI96AM9h-gzGzoHsz';
	var APP_KEY = 'TrVpB16Og6Yac9u3BoiUy4hT';
	AV.init({
		appId: APP_ID,
		appKey: APP_KEY
	});
}
//获取个人消息
function getinfo(e) {
	var curr = AV.User.current();
	if(curr) {
		console.log(curr);
		e.mycurr = false;
		this.myid = curr.id;
		var query = new AV.Query('order');
		query.contains('userid', curr.id);
		query.find().then(function(data) {
			console.log("进入");
			myVue.list = data.reverse();
			console.log(myVue.list);
		}, function(error) {
			console.log("失败了");
		});
	} else {
		e.mycurr = true;
		console.log("未登录");
	}
}